package cn.signUpSystem.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;

import cn.signUpSystem.pojo.Admin;
import cn.signUpSystem.service.AdminService;

@Service("adminService")
@SuppressWarnings("unchecked")
public class AdminServiceImpl extends BaseServiceImpl<Admin> implements
		AdminService {

	public boolean login(Admin admin) {
		List<Admin> admins = hibernateTemplate.findByNamedParam(
				"FROM Admin a WHERE a.name=:name AND a.password=:password",
				new String[] { "name", "password" },
				new String[] {
						admin.getName(),
						DigestUtils.md5DigestAsHex((admin.getPassword())
								.getBytes()) });
		return admins.size() > 0 ? true : false;
	}
}
